/*
 * @Author: Islands 1430536748@qq.com
 * @Date: 2024-07-13 01:49:05
 * @LastEditors: 周洋 1430536748@qq.com
 * @LastEditTime: 2024-08-10 00:24:50
 * @version: 1.1.4
 * @Description: 全局入口
 */
import { createApp,defineAsyncComponent } from 'vue';
import App from './App.vue';
import 'virtual:uno.css';
import '@/assets/index.css';
import 'animate.css';
import '@/assets/icon/iconfont/iconfont.css'
import '@/assets/icon/iconfont/iconfont.js';
import '@/plugins/router/modules/dynamic'
import {setupStore,setupRouter,setupI18n} from '@/plugins';
const app = createApp(App);
setupStore(app);
setupRouter(app);
setupI18n(app);
app.mount('#app')


//初始化布局组件
function registerGlobalAsyncComponents(app: any) {
    const modules = import.meta.glob('/src/layout/Main/src/**.vue');
    for (const path in modules) {
        const result = path.match(/.*\/(.+).vue$/);                
        if (result) {
            const name = result[1];
            const component: any = modules[path];            
            app.component(name, defineAsyncComponent(component));
        }
    }
}
registerGlobalAsyncComponents(app)